import java.util.Scanner;
import java.util.Random;
public class test2 {
    public static void main(String[] args) {
        Random random = new Random();
        Scanner scanner = new Scanner(System.in);
        int lotteryDigit1 = random.nextInt(10);
        int lotteryDigit2 = random.nextInt(10);
        int lotteryDigit3 = random.nextInt(10);
        int lottery = lotteryDigit1 * 100 + lotteryDigit2 * 10 + lotteryDigit3;
        System.out.print("Enter a three-digit integer: ");
        int userInput = scanner.nextInt();
        int userDigit1 = userInput / 100;
        int userDigit2 = (userInput / 10) % 10;
        int userDigit3 = userInput % 10;
        int matchCount = 0;
        if (userDigit1 == lotteryDigit1 || userDigit1 == lotteryDigit2 || userDigit1 == lotteryDigit3) 
            matchCount++;
        if (userDigit2 == lotteryDigit1 || userDigit2 == lotteryDigit2 || userDigit2 == lotteryDigit3) 
            matchCount++;
        if (userDigit3 == lotteryDigit1 || userDigit3 == lotteryDigit2 || userDigit3 == lotteryDigit3) 
            matchCount++;
        if (userInput == lottery) {
            System.out.println("Congratulations! All digits match in order. You win $10000.");
        } else if (matchCount == 3) {
            System.out.println("All digits match (order doesn't matter). You win $3000.");
        } else if (matchCount >= 1) {
            System.out.println("At least one digit matches. You win $1000.");
        } else {
            System.out.println("No digits match. You don't win.");
        }
        System.out.println("Lottery number: " + lottery);
        scanner.close();
    }
}
